import Vue from 'vue';
import Vuex from 'vuex';
import createLogger from 'vuex/dist/logger'

Vue.use(Vuex);

const state = {
    breadListState:[],
    carrier: {},
    simcards: {},
    alert: {}
}
const mutations = {
    breadListStateAdd(state,obj){
     state.breadListState.push(obj);
    },
    breadListStateRemove(state,num){
     state.breadListState.splice(1,num);
     
    },
    breadListStateClear(state){
        state.breadListState=[]
    },
    setCarrier(state, obj) {
        state.carrier = obj
    },
    setSimcards(state, obj) {
        state.simcards = obj
    },
    setAlert(state, obj) {
        state.alert = obj
    }
}

const getters = {
    carrier(state) {
       return state.carrier
    },
    simcards(state) {
        return state.simcards
    },
    alert(state) {
        return state.alert
    }
}

const debug = process.env.NODE_ENV !== 'production'

export default new Vuex.Store({
	state,
    mutations,
    getters,
    strict: debug,
    plugins: debug ? [createLogger()] : []
})